package com.xian.param;

public class Test4 {
    public static void main(String[] args) {
        //需求：从整型数组中返回某个数据的索引，，不存在返回-1

        int [] arrs = {11,22,33,55,66,88};
        int index = searchIndex(arrs,110);
        System.out.println(index);
    }

    public static int searchIndex(int[] arr,int data){
        for (int i = 0; i < arr.length; i++) {
            if(arr[i] == data){
                return i;
            }
        }
        return -1;
    }
}
